% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/get_acs-poststrat.R
\name{get_acs_cces}
\alias{get_acs_cces}
\title{Obtain a ACS tabulation from tidycensus}
\usage{
get_acs_cces(
  varlist,
  varlab_df = ccesMRPprep::acscodes_df,
  year = 2018,
  states = NULL,
  dataset = "acs1",
  geography = "congressional district"
)
}
\arguments{
\item{varlist}{a vector of variable codes to pull}

\item{varlab_df}{a dataframe that appends the categories based on the varcode}

\item{year}{The year of the ACS to get. Because of data availability limitations, this is
capped to 2010-2018.}

\item{states}{A vector of states to subset to. Gets passed onto the new \code{state}
argument in \code{tidycensus::get_acs()}, which defaults to NULL.}

\item{dataset}{Which type of ACS to get. Defaults to \code{"acs1"} for ACS-5 year.
Use \code{"acs5"} for 5-year.}

\item{geography}{the type of geography to pull. Currently only supports
\code{"congressional district"}.}
}
\description{
This loads ACS counts via tidycensus and gives them additional labels and
renames some variables to later merge with CCES-based regression models.
}
\details{
To run this, you need to have a API token to run \link[tidycensus]{get_acs}.
See \link[tidycensus]{census_api_key} for details.
}
\examples{
\dontrun{
 fm_brm <- yes | responses(n_cell) ~  age + gender + educ + pct_trump + (1|cd)
 acs_tab <- get_acs_cces(
              varlist = acscodes_age_sex_educ,
              varlab_df = acscodes_df,
              year = 2018)
#   year  cd    gender age            educ         race  count count_moe
#   <dbl> <chr> <fct>  <fct>          <fct>        <fct> <dbl>     <dbl>
# 1  2018 AL-01 Male   18 to 24 years HS or Less   NA      703       240
# 2  2018 AL-01 Male   18 to 24 years HS or Less   NA     5665       581
# 3  2018 AL-01 Male   18 to 24 years HS or Less   NA    11764       747
# 4  2018 AL-01 Male   18 to 24 years Some College NA     9528       750
# 5  2018 AL-01 Male   18 to 24 years Some College NA     1389       355
# 6  2018 AL-01 Male   18 to 24 years 4-Year       NA     1519       276


 poststrat <-  get_poststrat(acs_tab, cd_info_2018, fm_brm)
}

}
\seealso{
\link{get_acs_cces}
}
